import java.util.List;

import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;

import com.chimpansoft.claculator.mathParser.ClacGrammarLexer;
import com.chimpansoft.claculator.mathParser.ClacGrammarParser;
import com.chimpansoft.claculator.mathParser.Term;


public class Claculator {

	public static void main(String[] args) {
		
		String s = "a=9; b=0.5; a^b; cos(0.3); sin(3+4*5+(5+6));";
		
		ANTLRStringStream stringStream = new ANTLRStringStream(s);
		
		ClacGrammarLexer lexer = new ClacGrammarLexer(stringStream);
		
		CommonTokenStream tokens = new CommonTokenStream(lexer);
		
		ClacGrammarParser parser = new ClacGrammarParser(tokens);
				
		try {
			
			parser.setPrecision(10000);
			
			List<Term> a = parser.prog();
			
			for(Term t : a) {
				System.out.println(t);
			}
			
		} catch (RecognitionException e) {
			System.err.println(e);
		}
	}
	
}
